package com.swak.boot.config.config;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import com.swak.boot.config.zookeeper.config.ZookeeperConfigAutoConfiguration;
import com.swak.config.properties.ConfigurationPropertiesBeans;
import com.swak.config.properties.ConfigurationPropertiesRebinder;

/**
 * 开启配置中心
 * 
 * @author 618lf
 */
@Configuration
@Import({ ZookeeperConfigAutoConfiguration.class })
public class ConfigAutoConfiguration {

	@Bean
	public ConfigurationPropertiesBeans ConfigurationPropertiesBeans() {
		return new ConfigurationPropertiesBeans();
	}

	@Bean
	public ConfigurationPropertiesRebinder ConfigurationPropertiesRebinder(ConfigurationPropertiesBeans beans) {
		return new ConfigurationPropertiesRebinder(beans);
	}

	@Bean
	public ConfigDataContextRefresher ConfigDataContextRefresher(ConfigurableApplicationContext context) {
		return new ConfigDataContextRefresher(context);
	}
}
